<?php 
global $post;
$sale_off = get_post_meta($post->ID,"gia-khuyen-mai",true);
$price = (get_post_meta($post->ID,"gia-ban",true)!="")?number_format(get_post_meta($post->ID,"gia-ban",true),0,",",".")." VNĐ":"Liên hệ";

if($sale_off!=""){
    $price =($sale_off!="")?number_format($sale_off,0,",",".")." VNĐ":"Liên hệ";
}
?>

<!-- Form dat mua hang-->
<form onsubmit="return buy_now(this)" class="form-buy-now" action="<?php echo admin_url('admin-ajax.php?action=save-order');?>" method="post">
    <div class="ajaxload"></div>
	<input type="hidden" value="<?php echo $post->ID;?>" name="id_product" />
    <div class="product-buy row-fluid">
        <div class="image-product span3">
            <?php woo_image("width=150&height=150");?>
        </div>
        
        <div class="span9">
            <h5 class="buynow-title"><?php the_title();?></h5>
            <p>
                <strong>Giá bán: </strong><span class="display-price"><?php echo $price;?> </span>|
                <strong>Size: </strong><input name="size" type="hidden" value="" /> <span class="display-size"></span>| 
                <strong>Màu: </strong><input name="color" type="hidden" value="" /> <span class="display-color"></span>|
                <strong>Số lượng: </strong><input name="quantity" type="hidden" value="" /><span class="display-quantity"></span>
            </p>
            
            
            <div class="payment-list">
                <h5 style="border-bottom: 1px solid #ccc;">Chọn phương thức thanh toán</h5>
                <?php $payments = get_terms("order-payment",array("orderby"=>'custom_sort','hide_empty'=>false));?>
                <ul>
                <?php foreach($payments as $key => $payment){ ?>
                    <li><input<?php echo ($key==0)?" checked='checked'":"";?> type="radio" name="payment" value="<?php echo $payment->term_id?>" id="<?php echo $payment->slug?>" /> 
                    <label for="<?php echo $payment->slug?>"><?php echo $payment->name;?></label></li>
                <?php } ?>
                </ul>
                <div class="clearfix"></div>
            </div>
        </div>
    </div>
    
    <h5 class="custom-title">Nhập thông tin khách hàng</h5>
    <ul>
        <li>	
            <label><strong>Họ tên * </strong></label>
            <input class="field-customer" name="fullname" value=""/>
        </li>
        
        <li>	
            <label><strong>Điện thoại *</strong></label>
            <input class="field-customer" name="phone" value="" />
        </li>
        <li>	
            <label><strong>Email* </strong></label>
            <input class="field-customer" name="email" value="" />
        </li>
        
        <li>	
            <label><strong>Tình/Thành *</strong></label>
                <input class="field-customer" name="local" value="" />
        </li>
        
        <li>
            <label><strong>Quận/Huyện *</strong></label>
            <input class="field-customer" name="district" value="" />
        </li>
        
        <li>	<label><strong>Địa chỉ *</strong></label>
            <input class="field-customer" name="address" value="" />
        </li>
        
        <li>	
            <label><strong>Ghi chú </strong></label>
            <textarea class="field-customer" name="message"></textarea>
        </li>
    </ul>
    
    <div class="fbuttons ac">
        <input type="submit" name="btnbuynow" value="Mua ngay" class="btn btn-large" />
    </div>
    <div class="clearfix"></div>
</form>
                